package org.jdns.jfreechess.chess;

import com.google.common.base.Objects;

public class ChessPiece {
  public enum Type {
    PAWN, BISHOP, KNIGHT, ROOK, QUEEN, KING;
  }

  public enum Color {
    BLACK, WHITE;
  }

  public final Type type;
  public final Color color;

  public ChessPiece(Type type, Color color) {
    this.type = type;
    this.color = color;
  }

  public Type getType() {
    return type;
  }

  public Color getColor() {
    return color;
  }

  @Override
  public int hashCode() {
    return Objects.hashCode(type, color);
  }

  @Override
  public boolean equals(Object obj) {
    if (this == obj) {
      return true;
    }
    if (obj == null) {
      return false;
    }
    if (getClass() != obj.getClass()) {
      return false;
    }
    ChessPiece other = (ChessPiece) obj;
    if (color != other.color) {
      return false;
    }
    if (type != other.type) {
      return false;
    }
    return true;
  }

}
